/**
 * Project:   warnme-app
 * File:      UiUtilities.java
 * License: 
 *            This file is licensed under GNU General Public License version 3
 *            http://www.gnu.org/licenses/gpl-3.0.txt
 *
 * Copyright: Bartosz Cichecki [ cichecki.bartosz@gmail.com ]
 * Date:      Mar 30, 2014
 */

package dtu.ds.warnme.app.utils;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.view.View;
import dtu.ds.warnme.app.application.ApplicationState;

/**
 * @author Bartosz Cichecki
 * 
 */
public class UiUtilities {

	public static void fadeInFadeOut(final View view1, final View view2) {
		int animationTime = ApplicationState.getApplicationState().getResources().getInteger(android.R.integer.config_shortAnimTime);

		view1.setVisibility(View.VISIBLE);
		view1.animate().setDuration(animationTime).alpha(1).setListener(new AnimatorListenerAdapter() {

			@Override
			public void onAnimationEnd(Animator animation) {
				view1.setVisibility(View.VISIBLE);
			}
		});

		view2.setVisibility(View.VISIBLE);
		view2.animate().setDuration(animationTime).alpha(0).setListener(new AnimatorListenerAdapter() {

			@Override
			public void onAnimationEnd(Animator animation) {
				view2.setVisibility(View.GONE);
			}
		});
	}

	private UiUtilities() {

	}

}
